﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace gvPoco.ChartOptions
{
    public class ColumnChart : BaseOptions
    {
        /// <summary>
        /// The duration of the animation, in milliseconds. For details, see 
        /// https://google-developers.appspot.com/chart/interactive/docs/animation
        /// </summary>
        public Animation animation { get; set; }

        /// <summary>
        /// Where to place the axis titles, compared to the chart area. 
        /// Supported values: in, out, and none
        /// </summary>
        public string axisTitlesPosition { get; private set; }

        public Bar bar { get; set; }
        
        /// <summary>
        /// Whether the chart throws user-based events or reacts to user interaction. 
        /// If false, the chart will not throw 'select' or other interaction-based events 
        /// (but will throw ready or error events), and will not display hovertext or 
        /// otherwise change depending on user input.
        /// </summary>
        public bool enableInteractivity { get; set; }

        /// <summary>
        /// The type of the entity that receives focus on mouse hover. Also affects 
        /// which entity is selected by mouse click, and which data table element is 
        /// associated with events. 
        /// Can be one of the following: datum, category
        /// In focusTarget category the tooltip displays all the category values. 
        /// This may be useful for comparing values of different series.
        /// </summary>
        public string focusTarget { get; private set; }

        /// <summary>
        /// An object with members to configure various horizontal axis elements.
        /// </summary>
        public HorizontalAxis hAxis {get; set;}

        /// <summary>
        /// If set to true, series elements are stacked.
        /// </summary>
        public bool isStacked { get; set; }

        /// <summary>
        /// If set to true, will draw series from right to left. The default is to draw 
        /// left-to-right. This option is only supported for a discrete major axis.
        /// </summary>
        public bool reverseCategories { get; set; }

        /// <summary>
        /// An array of objects, each describing the format of the corresponding series in the chart. 
        /// To use default values for a series, specify an empty object {}. If a series or a value is 
        /// not specified, the global value will be used.
        /// </summary>
        public List<Series> series { get; set; }

        /// <summary>
        /// Specifies properties for individual vertical axes, if the chart has multiple 
        /// vertical axes. Each child object is a vAxis object, and can contain all the 
        /// properties supported by vAxis. These property values override any global 
        /// settings for the same property.
        /// </summary>
        public List<VerticalAxis> vAxes { get; set; }

        /// <summary>
        /// An object with members to configure various vertical axis elements. 
        /// </summary>
        public VerticalAxis vAxis { get; set; }


        public ColumnChart()
        {
            chartType = "ColumnChart";
            animation = new Animation();
            bar = new Bar();
            hAxis = new HorizontalAxis();
            vAxis = new VerticalAxis();
            focusTarget = "datum";
            axisTitlesPosition = "out";
            enableInteractivity = true;
            isStacked = false;
        }

        /// <summary>
        /// Set where to place the axis titles, compared to the chart area. 
        /// Supported values: in, out, and none
        /// </summary>
        /// <param name="value">The value of the axisTitlesPosition property</param>
        public void SetAxisTilesPosition(string value)
        {
            string[] valids = { "in", "out", "none" };
            if (valids.Contains(value))
            {
                axisTitlesPosition = value;
            }
        }

        /// <summary>
        /// The type of the entity that receives focus on mouse hover. Also affects 
        /// which entity is selected by mouse click, and which data table element is 
        /// associated with events. 
        /// Can be one of the following: datum, category
        /// </summary>
        /// <param name="value">The value of the focusTarget property</param>
        public void SetFocusTarget(string value)
        {
            string[] valids = { "datum", "category" };
            if (valids.Contains(value))
            {
                focusTarget = value;
            }
        }

    }
}